<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../fonts/iconfont.css" />
		<style>
			.mui-bar-tab .mui-tab-item.mui-active {
				color: #ff6600;
			}
		</style>
	</head>

	<body>
		<div class="mui-content ">
			<nav id="bar" class="mui-bar mui-bar-tab" style='border-top:1px solid transparent;'>
				<a class="mui-active  mui-tab-item tab-nav" href="tab-main.html" data-id="revenue" index="1">
					<span class="mui-icon iconfont icon-gg"></span>
					<span class="mui-tab-label">收入</span>
				</a>
				<a class="mui-tab-item tab-nav" href="coinOperated.html" data-id="coinOperated" index="2">
					<span class="mui-icon iconfont icon-dotcircleo"></span>
					<span class="mui-tab-label">投币</span>
				</a>
				<a class="mui-tab-item tab-nav" href="rewordReport.html" data-id="rewordReport" index="3">
					<span class="mui-icon iconfont icon-githubalt"></span>
					<span class="mui-tab-label">返奖</span>
				</a>

				<a class="mui-tab-item tab-nav" href="lottery.html" data-id="lottery" index="4" >
					<span class="mui-icon iconfont icon-money-score" ></span>
					<span  class="mui-tab-label">彩票</span>
				</a>
				<a class="mui-tab-item"></a>
				<a class="mui-tab-item"></a>
				<a class="mui-tab-item"></a>
			</nav>
		</div>
		<script src="../js/mui.min.js"></script>
		<script type="text/javascript">
			mui.init()
			mui.plusReady(function() {
				var currentShopObj = {},
					pageId = '',
					tabsConfig = {
						coinOperated: {
							title: '投币报告',
							htmlPath: 'coinOperated.html',
							id: 'coinOperated',
						},
						revenue: {
							title: '收入报告',
							htmlPath: 'income.html',
							id: 'revenue',
							default: true
						},
						rewordReport: {
							title: '返奖报告',
							htmlPath: 'rewordReport.html',
							id: 'rewordReport'
						},
						lottery: {
							title: '彩票报告',
							htmlPath: 'lottery.html',
							id: 'lottery'
						}
					}
				var self = plus.webview.currentWebview();
				
				currentShopObj = self.currentShopObj;
				pageId = self.pageId
				var tabs = {}
				for(id in tabsConfig) {
						tabs[id] = plus.webview.create(
						tabsConfig[id].htmlPath, 
						id,
						{
							top: '0',
							bottom: '51px',
							titleNView: {
								titleText: tabsConfig[id].title,
								titleColor: "#FFFFFF",
								titleSize: "17px",
								backgroundColor: "#FF6800",
								autoBackButton: true,
								buttons: [{
									fontWeight: 'normal',
									fontSize: '18px',
									float: 'right',
									fontSrc: "_www/fonts/iconfont.ttf", //wap2app内置字体文件
									text: "\ue602",
									onclick: function() {
										var allPage = plus.webview.all()
										var nowPage = plus.webview.getWebviewById('index')
										for(var i = 0; i < allPage.length; i++) {
											if(allPage[i].getURL() !== nowPage.getURL()) {
												plus.webview.close(allPage[i]);
											}
										}
									}
								}],
								splitLine: {
									color: "#CCCCCC",
									height: "1px"
								}
							}
						},
						{
							currentShopObj: currentShopObj,
							pageId: pageId
						});
					if(tabsConfig[id]['default']) {
						self.append(tabs[id]);
						current = id;
					}
				}
				//
				mui('.mui-bar-tab').on('tap', '.tab-nav', function(e) {
					var index = this.getAttribute('index');
					if(current == this.dataset.id) {
						return;
					}
					tabs[this.dataset.id].show();
					tabs[current].hide();
					current = this.dataset.id;
				})
			})
		</script>
	</body>

</html>